This very simple sample dumps a text version of the OT port registry to stdout. The compiled executable also makes a handy debugging tool.
Implementation Notes
The code is very simply: it calls OTGetIndexedPort repeatedly and then prints the contents of each OTPortRecord in turn. The ‘value add’ is:
• it shows how to interpret each field of the OTPortRecord
• the final output is useful for debugging things that register ports
The code was written with CodeWarrior 9 and tested on multiple machines running a variety of versions of Open Transport.
Caveats
One of the routines that the sample calls, OTGetUserPortNameFromPortRef, has no Mixed Mode glue. Thus you have to run the 68K version on a 68K Mac and the PPC version on a PPC Mac, otherwise the sample just quits halfway through.
Credits and Version History
If you find any problems with this sample, mail <DevSupport@applelink.apple.com> with “Attn: Quinn” as the first line of your mail and I’ll try to fix them up.